package pl.com.britenet.myredmine.dao.mdb.domain;

import java.io.Serializable;
import java.sql.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**
 * Domain class for table ISSUE.
 * 
 * @author <a href="mailto:pawel.sprysak@britenet.com.pl">Paweł Sprysak</a>
 * 
 */
@Entity
@Cache(region = "permanent", usage = CacheConcurrencyStrategy.READ_WRITE)
//TODO: Make annotation and LightEntity
//@GenService
@Table(name = "ISSUE")
public class Issue implements Serializable {  //extends LightEntity

    /**
     * Serial number.
     */
    private static final long serialVersionUID = 3441077254006459116L;

    /**
     * Id.
     */
    @Id
    @GeneratedValue(generator = "native")
    @GenericGenerator(name = "native", strategy = "native", parameters = { @Parameter(name = "sequence", value = "SEQ_ISSUE_ID") })
    @Column(name = "ID", nullable = false)
    private Integer id;
    
    /**
     * Type.
     */
    //TODO: Make enum.
    @Column(name = "TYPE")
    private Integer type;
    
    /**
     * Status.
     */
    //TODO: Make enum.
    @Column(name = "STATUS")
    private Integer status;
    
    /**
     * Priority.
     */
    //TODO: Make enum.
    @Column(name = "PRIORITY")
    private Integer priority;
    
    /**
     * Subject.
     */
    @Column(name = "SUBJECT")
    private String subject;
    
    /**
     * Owner.
     */
    @OneToOne(fetch = FetchType.LAZY)
//    @JoinColumn(name = "USERS_ID", nullable = false)
    @ForeignKey(name = "FK_ISSUE_USER1")
    private Users owner;
    
    /**
     * Creator.
     */
    @OneToOne(fetch = FetchType.LAZY)
//    @JoinColumn(name = "USERS_ID", nullable = false)
    @ForeignKey(name = "FK_ISSUE_USER2")
    private Users creator;
    
    /**
     * Last change.
     */
    @Column(name = "LAST_CHANGE")
    private Date lastChange;
    
    /**
     * Added date.
     */
    @Column(name = "DATE_ADDED")
    private Date dateAdded;
    
    /**
     * Start date.
     */
    @Column(name = "START_DATE")
    private Date startDate;
    
    /**
     * End date.
     */
    @Column(name = "END_DATE")
    private Date endDate;
    
    /**
     * Stage.
     */
    //TODO: Make enum.
    @Column(name = "STAGE")
    private Integer stage;
    
    /**
     * Percent.
     */
    @Column(name = "PERCENT")
    private Integer percent;
    
    /**
     * Estimated time.
     */
    @Column(name = "ESTIMATED_TIME")
    private Double estimatedTime;
    
    /**
     * Spent time.
     */
    @Column(name = "SPENT_TIME")
    private Double spentTime;
    
    /**
     * Finish revision.
     */
    @Column(name = "FINISH_REV")
    private Integer finishRev;
    
    /**
     * Bug revision.
     */
    @Column(name = "BUG_REV")
    private Integer bugRev;
    
    /**
     * Fixed revision.
     */
    @Column(name = "FIX_REV")
    private Integer fixRev;
    
    /**
     * Description.
     */
    @Column(name = "DESCRIPTION")
    private String description;

    /**
     * Setter for property "id".
     * 
     * @param id
     *            Value of property "id".
     */
	public void setId(Integer id) {
		this.id = id;
	}

    /**
     * Getter for property "id".
     * 
     * @return Value of property "id".
     */
	public Integer getId() {
		return id;
	}

    /**
     * Setter for property "type".
     * 
     * @param type
     *            Value of property "type".
     */
	public void setType(Integer type) {
		this.type = type;
	}

    /**
     * Getter for property "type".
     * 
     * @return Value of property "type".
     */
	public Integer getType() {
		return type;
	}

    /**
     * Setter for property "status".
     * 
     * @param status
     *            Value of property "status".
     */
	public void setStatus(Integer status) {
		this.status = status;
	}

    /**
     * Getter for property "status".
     * 
     * @return Value of property "status".
     */
	public Integer getStatus() {
		return status;
	}

    /**
     * Setter for property "priority".
     * 
     * @param priority
     *            Value of property "priority".
     */
	public void setPriority(Integer priority) {
		this.priority = priority;
	}

    /**
     * Getter for property "priority".
     * 
     * @return Value of property "priority".
     */
	public Integer getPriority() {
		return priority;
	}

    /**
     * Setter for property "subject".
     * 
     * @param subject
     *            Value of property "subject".
     */
	public void setSubject(String subject) {
		this.subject = subject;
	}

    /**
     * Getter for property "subject".
     * 
     * @return Value of property "subject".
     */
	public String getSubject() {
		return subject;
	}

    /**
     * Setter for property "owner".
     * 
     * @param owner
     *            Value of property "owner".
     */
	public void setOwner(Users owner) {
		this.owner = owner;
	}

    /**
     * Getter for property "owner".
     * 
     * @return Value of property "owner".
     */
	public Users getOwner() {
		return owner;
	}

    /**
     * Setter for property "creator".
     * 
     * @param creator
     *            Value of property "creator".
     */
	public void setCreator(Users creator) {
		this.creator = creator;
	}

    /**
     * Getter for property "creator".
     * 
     * @return Value of property "creator".
     */
	public Users getCreator() {
		return creator;
	}

    /**
     * Setter for property "lastChange".
     * 
     * @param lastChange
     *            Value of property "lastChange".
     */
	public void setLastChange(Date lastChange) {
		this.lastChange = lastChange;
	}

    /**
     * Getter for property "lastChange".
     * 
     * @return Value of property "lastChange".
     */
	public Date getLastChange() {
		return lastChange;
	}

    /**
     * Setter for property "dateAdded".
     * 
     * @param dateAdded
     *            Value of property "dateAdded".
     */
	public void setDateAdded(Date dateAdded) {
		this.dateAdded = dateAdded;
	}

    /**
     * Getter for property "dateAdded".
     * 
     * @return Value of property "dateAdded".
     */
	public Date getDateAdded() {
		return dateAdded;
	}

    /**
     * Setter for property "startDate".
     * 
     * @param startDate
     *            Value of property "startDate".
     */
	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

    /**
     * Getter for property "startDate".
     * 
     * @return Value of property "startDate".
     */
	public Date getStartDate() {
		return startDate;
	}

    /**
     * Setter for property "endDate".
     * 
     * @param endDate
     *            Value of property "endDate".
     */
	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

    /**
     * Getter for property "endDate".
     * 
     * @return Value of property "endDate".
     */
	public Date getEndDate() {
		return endDate;
	}

    /**
     * Setter for property "stage".
     * 
     * @param stage
     *            Value of property "stage".
     */
	public void setStage(Integer stage) {
		this.stage = stage;
	}

    /**
     * Getter for property "stage".
     * 
     * @return Value of property "stage".
     */
	public Integer getStage() {
		return stage;
	}

    /**
     * Setter for property "percent".
     * 
     * @param percent
     *            Value of property "percent".
     */
	public void setPercent(Integer percent) {
		this.percent = percent;
	}

    /**
     * Getter for property "percent".
     * 
     * @return Value of property "percent".
     */
	public Integer getPercent() {
		return percent;
	}

    /**
     * Setter for property "estimatedTime".
     * 
     * @param estimatedTime
     *            Value of property "estimatedTime".
     */
	public void setEstimatedTime(Double estimatedTime) {
		this.estimatedTime = estimatedTime;
	}

    /**
     * Getter for property "estimatedTime".
     * 
     * @return Value of property "estimatedTime".
     */
	public Double getEstimatedTime() {
		return estimatedTime;
	}

    /**
     * Setter for property "spentTime".
     * 
     * @param spentTime
     *            Value of property "spentTime".
     */
	public void setSpentTime(Double spentTime) {
		this.spentTime = spentTime;
	}

    /**
     * Getter for property "spentTime".
     * 
     * @return Value of property "spentTime".
     */
	public Double getSpentTime() {
		return spentTime;
	}

    /**
     * Setter for property "finishRev".
     * 
     * @param finishRev
     *            Value of property "finishRev".
     */
	public void setFinishRev(Integer finishRev) {
		this.finishRev = finishRev;
	}

    /**
     * Getter for property "finishRev".
     * 
     * @return Value of property "finishRev".
     */
	public Integer getFinishRev() {
		return finishRev;
	}

    /**
     * Setter for property "bugRev".
     * 
     * @param bugRev
     *            Value of property "bugRev".
     */
	public void setBugRev(Integer bugRev) {
		this.bugRev = bugRev;
	}

    /**
     * Getter for property "bugRev".
     * 
     * @return Value of property "bugRev".
     */
	public Integer getBugRev() {
		return bugRev;
	}

    /**
     * Setter for property "fixRev".
     * 
     * @param fixRev
     *            Value of property "fixRev".
     */
	public void setFixRev(Integer fixRev) {
		this.fixRev = fixRev;
	}

    /**
     * Getter for property "fixRev".
     * 
     * @return Value of property "fixRev".
     */
	public Integer getFixRev() {
		return fixRev;
	}

    /**
     * Setter for property "description".
     * 
     * @param description
     *            Value of property "description".
     */
	public void setDescription(String description) {
		this.description = description;
	}

    /**
     * Getter for property "description".
     * 
     * @return Value of property "description".
     */
	public String getDescription() {
		return description;
	}

}
